package ua.yandex.skipass;

import ua.yandex.skipass.SkiPassSystem.SkiPass;

import java.util.Date;

/**
 * Created by ffbit on 11/20/14.
 */
public class Turnstile {

    public boolean isAllowed(SkiPass skiPass) {
        return isAllowed(skiPass, new Date());
    }

    private boolean isAllowed(SkiPass skiPass, Date date) {
        // Перенести в SkiPass
        return false;
        //!skiPass.isExpired()
        //&& !skiPass.isBlocked()
        //&& skiPass.isAllowed(date);
    }

    public void withdrawLifting(SkiPass skiPass) {
        Date date = new Date();

        if (!isAllowed(skiPass, date)) {
            throw new IllegalSkiPassAccessException();

        }
        skiPass.withdrawLifting(date);


    }

}
